<?
/**
 * xml.php
 *
 * <pre>
 * Devyra Internacionalnaya
 * Vebba PHP Framework and Website Builder
 * Source file for XML operations
 * </pre>
 *
 * @package   classes.core.static
 * @version   0.7.0102 alpha
 * @since     2012
 * @author    Paul Dinh
 * @copyright Devyra Internacionalnaya
 */
 
/**
 * Class contains miscellaneous utils for XML
 *
 * @package classes.core.static
 * @version 0.7.0102 alpha
 * @since   2012
 * @author  Paul Dinh
 */
class xml {

  /**
   * Default instance level constructor
   */
  public function __construct() {
    //
  }
  
  /**
   * Standard initialisation
   */
  public static function initialise() {
    //
  }
  
  /**
   * Parse XML text into array 
   *
   * @param  string $Xml_Text The XML text to be parsed
   * @return array  The array containing values (root tag included)
   */
  public static function parse_text($Xml_Text) { 
    $Xml_Obj = simplexml_load_string($Xml_Text); 
    return utils::obj_to_arr($Xml_Obj);
  }
  
  /**
   * Load a XML file and parse to array
   *
   * @param  string $File_Path The file path to XML file
   * @return array The correspoding array to that XML
   */
  public static function arr_from_file($File_Path) { 
    $Xml_Text = file_get_contents($File_Path); 
    return self::parse_text($Xml_Text);
  }
}
  
//END-OF-FILE
